<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/taglib.jsp"%>
<html>
<head>
<meta charset="UTF-8">
<title>我的账户-充值</title>
<jsp:include page="/include/wchat/head.jsp"></jsp:include>

<link type="text/css" rel="stylesheet"
	href="/v2/wchat/resrc/css/account.css">
</head>

<body>
	<div id="header">
		<a href="javascript:history.go(-1);" class="backto">返回</a>
		<div class="title-sub">账户充值</div>
	</div>
	<div id="wrap">
		<form action="/allinPayIsBindBankCard.do" method="POST"
			id="allinPayIsBindBankCard">
			<div class="rechange">

				<div class="link-touch">
					<ul>
						<li class="money"><label class="txt"> 充值金额 </label> <input
							class="input" id="tranAmt" name="tranAmt"
							placeholder="请输入您要充值的金额"></li>
					</ul>
					<div id="errorTip" class="vtip errs"></div>
				</div>
				<input type="hidden" id="realnameFlag"
					value="${userMaterialsauthStats}">
				<div class="operate-button">
					<a href="javascript:void(0)" id="submit" class="btn">下一步</a> <a
						href="/wchatRealNameAuthen.do" class="btn" id="realNameBt"
						style="display: none;">立即实名认证</a>
				</div>
			</div>
		</form>
		<div class="itip">
			<div class="title">
				<h2>温馨提示：</h2>
			</div>
			<div>
				<ul class="items">
					<p>1. 为了您的资金安全，请您在充值之前先完成实名认证；</p>
					<p>
						2. <span class="light-org">每日单笔最低充值金额100元，最高充值金额5万元</span>；
					</p>
					<p>3. 严禁利用充值功能进行信用卡套现、转账、洗钱等行为，一经发现，资金将退回原卡并封停账号30天；</p>
					<p>4. 判定为风险、可疑交易的资金将通过第三方支付平台退回原卡，到账时间以发卡行通知为准；</p>
					<p>
						5. 点击充值按钮，表示您已经仔细阅读并同意《 <a href="/getMessageBytypeId.do?typeId=22">共富网投资咨询与管理服务协议</a>》和
						《 <a href="/v2/wchat/appCommon/protocol/fundMng.jsp">共富网资金管理规定</a>》
					</p>
				</ul>

			</div>

		</div>
		<jsp:include page="/include/wchat/footer.jsp"></jsp:include>

		<script type="text/javascript">
			$(function() {
				pushHistory();
				window.addEventListener("popstate", function(e) {
					window.location.href = "/wchatUserCenter.do"; //微信返回url
				}, false);
				function pushHistory() {
					var state = {
						title : "title",
						url : "#"
					};
					window.history.pushState(state, "title", "#");
				}
				$("#submit").click(function() {

					//未实名认证，不能充值
					if ($("#realnameFlag").val() == "0") {
						$('#errorTip').html('请您先完成实名认证');
						$('#realNameBt').show();
						$('#submit').hide();
						return;
					}

					if (sureMoney()) {
                        allinPayIsBindBankCard();
					}
				});
			});

			function allinPayIsBindBankCard() {
				$("#allinPayIsBindBankCard").submit();
			}

			function sureMoney() {
				var mput = $('#tranAmt');
				var merr = $('#errorTip');
				var charge = $.trim(mput.val());
				if (isNaN(charge * 1) || charge * 1 <= 0) {
					merr.html('请输入正确的充值金额').show();
					mput.addClass('inputErr');
					mput.val('');
					mput.focus();
					return false;
				} else if (charge * 1 < 100) {
					merr.html('每日单笔最低充值金额100元').show();
					mput.addClass('inputErr');
					mput.val('');
					mput.focus();
					return false;
				} else if (charge * 1 > 50000) {
					merr.html('每日单笔最高充值金额5万元').show();
					mput.addClass('inputErr');
					mput.val('');
					mput.focus();
					return false;
				} else {
					merr.html('').hide();
					return true;
				}
			}
		</script>
</body>
</html>